<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        var myname = 'pink';
        console.log(myname);
        myname = 'fyh';
        console.log(myname);

        var age =18,
            address = '火影',
            age =200;

        var sex;
        console.log(sex);

        console.log(isNaN(12));
        alert('"开心哟"');

        // 检测获取字符串的长度 length
        var str = 'my name is fy';
        console.log(str.length);


        // 字符串的拼接+  只要有字符串和其他类型相拼接 最终的结果是字符串类型
        console.log('沙漠'+'骆驼');
        console.log('fyh'+18);
        console.log('fyh'+ true);
        console.log(12+18);
        console.log('12'+ 18);

        console.log('fyh'+age+'岁');

        var flag = true;//1
        var flag1= false;//0
        console.log(flag+flag1);

        console.log(typeof flag);

        // 数据类型的转换
        var num = 10;
        var str = num.toString();
        console.log(typeof str);
        console.log(String(num));
        console.log(num+'')

        // 转换为数字型
        var abb = prompt("请输入您的年龄")
        console.log(parseInt(abb));
    </script>
</head>
<body>
    
</body>
</html>